<?php


echo '<form action="" method="post" enctype="multipart/form-data" name="orderForm" target="_parent">';
$q=$_GET["q"];
        $TABLE1 = "Parts";
        $TABLE2 = "Parts_Required";
        $TABLE3 = "Finished_Goods";
        $ROW_NUMBER = 0;
        $PASS = "";
        $USER = "root";
        $HOST = "localhost";
        $CON = mysql_connect( $HOST, $USER, $PASS );
        $DB = "softengtestdatabase";
        if (!$CON)
          {
                  die('Could not connect: ' . mysql_error());
          }

        mysql_select_db( $DB );
        $QRY = "SELECT Parts.part_id, Finished_Goods.fg_id, Parts.cost, Parts.part_description FROM Parts, Parts_Required, Finished_Goods WHERE Parts.part_id = Parts_Required.part_id AND Parts_Required.fg_id = Finished_Goods.fg_id AND Finished_Goods.fg_id ='".$q."'";

        $result = mysql_query($QRY) or die($QRY."<br/><br/>".mysql_error());


echo "<p><center>Please select a finished good: ";
        echo "<select name=\"finishgood_list\">";
        while ($row = mysql_fetch_array($result))
        {
            echo "<option value='" . $row['part_id'] . "'>" . $row['part_id'] . "</option>";
        }
        echo "</select></center></p>";

        mysql_close($CON);
        echo '</form>';
?>




